package com.hefu.virtuallife.ui.foods;

import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.widget.ImageButton;
import android.widget.TextView;

import com.dz.utlis.ClassTools;
import com.dz.utlis.JavaUtils;
import com.hefu.virtuallife.R;
import com.hefu.virtuallife.baseui.BaseActivity;
import com.hefu.virtuallife.baseui.BaseFragment;
import com.hefu.virtuallife.ui.foods.adapter.MyMenuePageAdapter;
import com.hefu.virtuallife.ui.foods.fragment.MyActivityFragment;
import com.hefu.virtuallife.ui.foods.fragment.MyCollectionSellerFragment;
import com.hefu.virtuallife.ui.foods.fragment.MyCustMenueFragment;
import com.hefu.virtuallife.ui.foods.fragment.MyPreMenueFragment;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;

/**
 * creat_user: zhengzaihong
 * Email:1096877329@qq.com
 * describe 美食收藏
 **/
public class MyFoodCollectionActivity extends BaseActivity {


    @BindView(R.id.iv_back)
    ImageButton ivBack;
    @BindView(R.id.tv_title)
    TextView tvTitle;
    @BindView(R.id.tv_right)
    TextView tvRight;
    @BindView(R.id.tv_delmenue)
    TextView tvDelmenue;
    @BindView(R.id.mTableLayout)
    TabLayout mTableLayout;
    @BindView(R.id.mViewPager)
    ViewPager mViewPager;


    private List<BaseFragment> listfragment = new ArrayList<>();

    private MyMenuePageAdapter myMenuePageAdapter;

    @Override
    protected int getContentLayoutId() {
        return R.layout.activity_my_collection_foods;
    }

    @Override
    protected void initWidget() {
        super.initWidget();
        ivBack.setVisibility(View.VISIBLE);
        tvTitle.setVisibility(View.VISIBLE);
        tvRight.setVisibility(View.VISIBLE);
        tvTitle.setText("美食收藏");
        tvRight.setText("完成");

        ivBack.setOnClickListener(v -> finish());
    }


    @Override
    protected void initData() {
        super.initData();

        BaseFragment sellers = new MyCollectionSellerFragment();
        sellers.setTitlefragment("商家");
        listfragment.add(sellers);

        BaseFragment activitys = new MyActivityFragment();
        activitys.setTitlefragment("活动");
        listfragment.add(activitys);
        myMenuePageAdapter = new MyMenuePageAdapter(getSupportFragmentManager(), listfragment);

        mViewPager.setAdapter(myMenuePageAdapter);
        mViewPager.setOffscreenPageLimit(listfragment.size());
        mTableLayout.setTabMode(TabLayout.MODE_FIXED);
        mTableLayout.setupWithViewPager(mViewPager);


        tvDelmenue.setOnClickListener(view -> {
        });
    }

}
